<template>
	<view>
		<view class="headinfo">
			<view class="userinfo">
				<view class="cont webkit">
					<image class="face" :src="res.avatar"></image>
					<view class="info">
						<text class="title" v-cloak>{{res.nickname}}</text>
						<text class="text" v-cloak>分享中心：{{res.upnickname}}</text>
						<text class="subtitle" v-cloak>{{res.levelname}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="yqm">
			<view class="webkit">
				<image src="../../static/yqm.png" mode=""></image>
				<text v-cloak>我的邀请码：{{res.yqm}}</text>
			</view>
		</view>
		<view class="coinlist clear">
			<view v-for="(item,index) in res.coins" :key="index" :data-id="item.id" class="webkit" @click="jumpcoin">
				<image src="../../static/yue.png"></image>
				<view class="flex">
					<text class="coinname" v-cloak>{{item.coinname}}</text>
					<text class="num" v-cloak>{{item.number}}</text>
				</view>
			</view>
		</view>
		<view class="list">
			<view class="uni-list">
				<view class="uni-list-cell" hover-class="active" @click="jump" data-src="qrcode/qrcode">
					<view class="uni-list-cell-navigate uni-navigate-right">
					<image src="../../static/share.png" mode=""></image>
					<text class="text">推广注册</text>
					</view>
				</view>
				<view class="uni-list-cell" hover-class="active" @click="jump" data-src="down/down">
					<view class="uni-list-cell-navigate uni-navigate-right">
					<image src="../../static/order.png" mode=""></image>
					<text class="text">我的团队</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				res:[],
				openid:''
			};
		},
		onLoad:function(){
			uni.showLoading()
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
					this.setAjax()
				},
				fail: () => {
					uni.navigateTo({
						url: '../login/login'
					});
				}
			});
		},
		methods:{
			setAjax(){
				uni.request({
					url: this.$BASE_URL+'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=commission.index&app=1',
					method: 'POST',
					data: {'openid':this.openid},
					header:{'Content-Type':'application/x-www-form-urlencoded'},
					success: res => {
						uni.hideLoading()
						this.res = res.data
						console.log(res);return;
						if(this.res.upnickname == null){
							this.res.upnickname = 'MG商城'
						}
					},
					fail: () => {},
					complete: () => {}
				});
			},
			jumpcoin(e){
				var id =e.currentTarget.dataset.id
				uni.navigateTo({
					url: 'mingxi?id='+ id
				});
			},
			jump(e){
				var src =e.currentTarget.dataset.src
				uni.navigateTo({
					url: src
				});
			}
		}
	}
</script>

<style>.coinlist{background:#fff;margin-top:20upx;padding:20upx 0;}.coinlist .webkit{width:50%;float:left;padding:20upx 24upx;box-sizing:border-box;}.coinlist .webkit:nth-child(2n + 1){border-right:1px solid #eaeaea;}.coinlist .webkit image{width:72upx;height:72upx;margin-right:20upx;margin-top:6upx;}.coinlist .webkit view text{display:block;font-size:24upx;}.coinlist .webkit view .num{color:#feb312;}.yqm{padding:32upx 24upx;background:#fff;}.yqm image{width:50upx;height:50upx;display:block;margin-right:10upx;}.yqm text{display:block;}.headinfo{background:#175e3c;}.headinfo .userinfo{min-height:160upx;padding:12upx 24upx;border-bottom:2upx solid #175e3c;position:relative;}.headinfo .userinfo .cont{padding:0;padding-top:20upx;padding-bottom:20upx;}.headinfo .userinfo .cont .face{width:120upx;height:120upx;border-radius:50%;margin-top:12upx;margin-right:30upx;}.headinfo .userinfo .cont .info{line-height:initial;}.headinfo .userinfo .cont .info text{display:block;margin-top:10upx;}.headinfo .userinfo .cont .info .title{color:#fff;font-size:28upx;font-weight:bold;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;margin-top:10upx;}.headinfo .userinfo .cont .info .text{color:#fff;font-size:22upx;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}.headinfo .userinfo .cont .info .subtitle{color:#fff;font-size:22upx;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;width:auto;display:inline-block;border:2upx solid #fff;border-radius:36upx;max-width:100%;padding:0 14upx;}.uni-list-cell.active{background:#f5f5f5;}.uni-list image{width:34upx;height:34upx;}.uni-list .text{position:absolute;left:84upx;font-size:26upx;}.uni-list{margin-top:20upx;}.uni-list:before,.uni-list:after{display:none;}.uni-list-cell:after{content:" ";position:absolute;left:0.5rem;right:0.5rem;bottom:-1px;height:1px;border-top:1px solid #ebebeb;color:#D9D9D9;-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleY(0.5);-ms-transform:scaleY(0.5);transform:scaleY(0.5);background:none;}.uni-list-cell .right{font-size:24upx;color:#999;margin-right:20upx;}.uni-list .uni-list-cell:last-child:after{border:0;}</style>